import 'package:flutter/material.dart';
import 'package:dio/dio.dart';
class Community extends StatefulWidget {
  const Community({Key? key}) : super(key: key);

  @override
  State<Community> createState() => _CommunityState();
}

class _CommunityState extends State<Community> {
  var personList=[];
  Color mainColor = const Color(0xff3C3261);
  // 模拟接口调试
  // void getData() async {
  //   //获取数据
  //   String getUrl = baseURL+'/profile/findAll';
  //   Dio dio = new Dio();

  //   var response = await dio.get(getUrl);

  //   print('Respone ${response.statusCode}');

  //   //前台似乎很方便? 因为后台已经处理了大部分逻辑! shit, 我是个全栈, 都由我来做!
  //   if (response.statusCode == 200) {
  //     Fluttertoast.showToast(
  //             msg: "sucess",
  //         gravity: ToastGravity.CENTER,
  //         textColor: Colors.grey);

  //       setState(() {
  //         //必须要通过这个来更新数据,否则将不会刷新页面
  //         personList=response.data;
  //       });
  //   }
  //   else{
  //     showToast("服务器或网络错误!");
  //   }
  // }

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    // getData();
    personList = [
      {'path':"",'username':'214654',"email":""}
    ];
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      appBar:AppBar(
        elevation: 0.3,
        centerTitle: true,
        backgroundColor: Colors.white,
        leading: Icon(Icons.supervised_user_circle_outlined,color: Colors.greenAccent,),
        title: Text(
          'Community',
          style: TextStyle(color: mainColor,fontWeight: FontWeight.bold),
          ),
        actions: const [
          Icon(Icons.list,color: Colors.greenAccent,)
        ],  
      
      ),
      body: new Padding(
        padding: const EdgeInsets.all(16.0),
        child: new Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            new Expanded(
              child: ListView(
                children: [
                  FlatButton(
                    onPressed: (){}, 
                    child: Column(
                      children:[
                        Row(
                        children: [
                          Padding(
                            padding: const EdgeInsets.all(0.0),
                            child: Container(
                             margin: EdgeInsets.all(16),
                             child: Container(
                              height: 70.0,
                              width: 70.0,
                             ),
                             decoration: new BoxDecoration(
                              borderRadius: BorderRadius.circular(10.0),
                              color: Colors.grey,
                              image: const DecorationImage(image:AssetImage("assets/china.png"),fit: BoxFit.cover),
                              boxShadow: [BoxShadow(color: mainColor,blurRadius: 5.0,offset: Offset(2.0,5.0))]
                             ),
                            ),
                            
                            ),
                            new Expanded(
                              child: Container(
                                margin: EdgeInsets.fromLTRB(16.0, 0.0, 16.0, 0.0),
                                child: Column(
                                  children: [
                                    Text(
                                      "LINXIHONG",
                                      style: TextStyle(
                                        fontSize: 20.0,
                                        fontWeight: FontWeight.bold,
                                        color: mainColor,
                                      ),
                                      ),
                                      Padding(padding: EdgeInsets.all(2.0)),
                                      Text(
                                        "411856938@qq.com",
                                        maxLines: 3,
                                        style: TextStyle(
                                          color: Color(0xff8785a4),
                                        ),
                                      )
                                  ],
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                ),
                              )
                              )
                        ],
                      ),
                      Container(
                        width: 300.0,
                        height: 0.5,
                        color: const Color(0xD2D2E1ff),
                        margin: const EdgeInsets.all(16.0),
                      )
                      ] 
                    ),
                  
                  )
                ],
                
              )
              )
          ],
        ),
        ),
    );
  }
}